package components
{
	import UIFree.uif_component;
	
	import flash.display.MovieClip;
	import flash.events.MouseEvent;
	import flash.geom.Rectangle;

	public class uif_container extends uif_component
	{
		public function uif_container(parent:uif_component, swc_class: Class, ax:int=0, ay:int=0, awidth:int=0, aheight:int=0, styleClass:String='') {
			super(parent, ax, ay, awidth, aheight, styleClass);
			var def: * = new swc_class();
			addChild(def as MovieClip);
			
			var inner: Rectangle = getInner();
			def.x = inner.x;
			def.y = inner.y;
			
			if (def['doFocus']) { 
				parent.addEventListener(MouseEvent.MOUSE_OVER, function(e: MouseEvent): void {
					def.doFocus(true);
				});
				parent.addEventListener(MouseEvent.MOUSE_OUT, function(e: MouseEvent): void {
					def.doFocus(false);
				});
			}
		}
		
	}
}